<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<% String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="ligerForm">
				<div class="fieldset1 tabel_col clearFix">
					<div class="caption">
						<span class="title">归档信息</span>
					</div>
					<div class="fieldBox col_50">
						<div class="label">合同号</div>
						<div class="field">
						<a href="javascript:detailPrjBtn( ${mgr.prjId})">
						<font color="blue">	${mgr.contractNo}</font>
						</a>
							
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">交接单名称</div>
						<div class="field">
						
								${mgr.arcReceiptName}
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">版本号</div>
						<div class="field">${mgr.versioni}
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">总部档案袋编号</div>
						<div class="field">${mgr.portfolioNumber}
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label">省公司档案袋编号</div>
						<div class="field">${mgr.portfolioNumberProvince}
						</div>
					</div>
					<!-- 筛选条件 -->
					<jsp:include page="arcMgrSS.jsp" flush="true" />
					
					<div class="caption">
						<span class="title">合同资料</span>
						${mgr.cstNm} ${mgr.contractNo}	
					</div>
					
					<div class="fieldBox col_100">
						<div style="width: 100%; ">
							<table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40 cellPadding=1 width="100%" align=center border=1> 
							<thead>
								<tr style="background:#E7FEF4">
									<th  style="text-align: center;width:5%;"></th>
									<th  style="text-align: center;width:10%">权证类别</th>
									<th  style="text-align: center;width:20%">权证名称</th>
									<th  style="text-align: center;width:8%">资料类型</th>
									<th  style="text-align: center;width:6%">是否必须</th>
									<th  style="text-align: center;width:6%">扫描件</th>
									<th  style="text-align: center;width:6%">操作人</th>
									<th  style="text-align: center;width:6%">操作时间</th>
									<th  style="text-align: center;width:6%">归档地点</th>
									<th  style="text-align: center;width:8%">要求归档份数</th>
									<th  style="text-align: center;width:10%">本次归档份数</th> 
									<th  style="text-align: center;width:10%">实际归档份数</th>
									<th  style="text-align: center;width:18%">扫描件上传</th>
								</tr>
							</thead>
							<tbody>
								<c:forEach items="${cList}" var="item" varStatus="status">
								   <c:if test="${item.fileName == '换车补充协议'}">	
									<tr>
										<td  style="text-align: center; height:20px;">1
										<div style="display:none;">
											<input type="text" name='arcReceiptDetailId' value="${item.arcReceiptDetailId}">
											<input type="text" name='arcDetailId' value="${item.id}">
										  </div>
									   </td>
										<td style="text-align: center; ">${item.fileFlagNm }</td>
										<td style="text-align: center; ">${item.fileName }</td>
										<td style="text-align: center; ">${item.dossierTempNm }</td>
										<td style="text-align: center; ">${item.ischoiceNm }</td>
										<td  style="text-align: center;">${item.arcReceiptDetailVO.isScanRequireNm }</td>
										<td  style="text-align: center;">${item.upUsrCdNm }</td>
										<td  style="text-align: center;"><fmt:formatDate type="date" value="${item.upUsrTm }"/></td>
										<td style="text-align: center; ">${item.arcReceiptDetailVO.arcPlaceNm }</td>
										<td style="text-align: center; ">${item.dossierCount }</td>
										<td style="text-align: center;">
									  <%--  <!-- 如果是电子的则显示连接，如果不是电子填写份数，如果归档中的不能填写，如果要求归档-已归档>0加默认值 -->
					               			<c:if test="${item.dossierTemp !='3'}">
							               			<c:if test="${item.dossierCount - item.dossierCountT>0}">
													<input value="${item.dossierCount - item.dossierCountT }" id="thisCount_c_code_${item.arcReceiptDetailId}" name="thisCount_c_code_${item.arcReceiptDetailId}"  type="text"   class="ui-textbox"  ligerui="width: 60" >
													</c:if>
													<c:if test="${!(item.dossierCount - item.dossierCountT>0)}">
													<input value="" id="thisCount_c_code_${item.arcReceiptDetailId}" name="thisCount_c_code_${item.arcReceiptDetailId}"  type="text"   class="ui-textbox"  ligerui="width: 60" >
													</c:if>
											</c:if>  --%>
											<c:if test="${arcInfoFlag =='1' }">
												${item.thisCount}
											</c:if>
											<c:if test="${arcInfoFlag =='2' }"><input value="${item.thisCount}" id="thisCount_c_code_${item.arcReceiptDetailId}" name="thisCount_c_code_${item.arcReceiptDetailId}"  type="text"   class="ui-textbox"  ligerui="width: 60" >
											</c:if>
										</td>
										<td style="text-align: center; "> ${item.checkCount }</td>
										<td>
										    <!-- 如果是连接附件 -->
											<c:if test="${item.ulFlag=='1'}">
												<c:forEach items="${item.ulFiles}" var="file" >
												<a  target="_blank" href="${file.filePath }" >查看</a>
												</c:forEach>
											</c:if>
											<!-- 如果不是连接附件 -->
											<c:if test="${item.ulFlag!='1'}">
												<!-- 不是电子的，只是显示节点的 -->
												<c:if test="${item.dossierTemp !='3' and (flag=='000' )  }">
												 <div  class="upfiles" id="${item.id}" pkId="${item.eleId}"  style="text-align:left"></div>
												</c:if>
												<!-- 不是电子的，不是显示节点的 -->
												<c:if test="${item.dossierTemp !='3'  and flag!='000'  }">
												<div  class="upfiles" id="${item.id}" fflag="1"  pkId="${item.eleId}"  style="text-align:left"></div>
												<div class="fieldBox col_100"  >
								                    	<span id="cst_rl_add_btn" onclick="upload(${item.id})"  class="sq-button sq-button-round">上传</span>
						               			</div>
						               			</c:if>
					               			 </c:if>
					               		   </td>
									    </tr>
									</c:if>
								</c:forEach>
							</tbody>
						</table>
						</div>
					</div>
				</div>
				<div class="btnsBox" style="text-align:center">
				    <input type="hidden" name="contractNo" value='${contractNo }'>
					<c:if test="${ arcInfoFlag =='1'}"><!-- 权证归档节点 -->
						<span id="saveBtn" class="sq-button sq-button-round"  onclick="save();">上架</span>
					</c:if>
					<c:if test="${ arcInfoFlag =='2'}"><!--合同管理员补充节点 -->
						<span id="saveBtn" class="sq-button sq-button-round"  onclick="save();">保存</span>
					</c:if>
				</div>
				
			</form>
		</div>
	</div>
	<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList2.jsp" flush="true" >
			            <jsp:param name="fflag" value="0"/>
			            <jsp:param name="tabNm" value="ARC_MGR_DETAIL"/>
    </jsp:include>
	<script type="text/javascript">
	 	if(${result.success}==0){
	 		alert("${result.info}");
	 	}
		var grid;
		var arcInfoFlag = '${arcInfoFlag}';
		console.log(arcInfoFlag);
		$(function() {
			$("#ligerForm").ligerForm({
				validate: true
			});
	    });
	</script>
	<script type="text/javascript">
	var grid;
	
	$(function() {
		$("#ligerForm").ligerForm({
			validate: true
		});
    });
	
	//保存
	function save(){
		var ligerForm = liger.get("ligerForm");
		
		var data = ligerForm.getData();//主表数据
		
		var isFlag ='${isFlag}';
		if(isFlag =='101'){
			$.ligerDialog.SQalert({content: "未查到归档信息，请在权证归档模块发起归档流程",SQ_type: "error"});
			return false;
		}
		
		//data["arcInfoFlag"] = '${arcInfoFlag}';
		data["contractNo"] = '${contractNo}';
		data["arcInfoFlag"] = '${arcInfoFlag}';
		
		console.log(data);
		var wait_dialog = null;
		$.ajax({
			type: 'post',
			dataType: 'json',
			data: data,
			url: '<%=path%>/archive/arcApplyMain/modifyMgrDetail.do?',
			beforeSend: function(){
				wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting"});
			},success:function(msg){
				wait_dialog.close();
				if(msg.success == 1){
						$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
				}else{
					$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
				}
			},error:function (XMLHttpRequest, textStatus, errorThrown) { 
				wait_dialog.close();
				$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
			} 
		});
	}
	//上传
	function upload(id){
		$.ligerDialog.SQopen({
            width: 820,
            height:550,
            title : '上传文件',
            url:'<%=path%>/archive/arcApplyMain/toUpload.do?flag=1&id='+id,
            // 自定义buttons的时候 不要设置 fixButtons: true
            buttons: [{
            	text: "保存", type: 'ok', cls: 'l-dialog-btn-ok', 
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onOk = function () {}
                    if (Dialog.onOk) {
                    	Dialog.onOk();
                    	//saveUpload(id);
                    }
                    
                }
            }, {
                text: "取消", type: 'cancel', cls: 'l-dialog-btn-no', 
                onclick: function (item, Dialog) {
                    //在子页面里绑定 frameElement.dialog.onCancel = function () {}
                    if (Dialog.onCancel) Dialog.onCancel();
                }
            }
            ]
        });
	}
	</script>
</body>
</html>